package com.observer;

import java.util.Observable;
import java.util.Observer;

/**
 * @author: sun.hongliang
 * @create: 2019/10/18 12:20
 */
public class PaddingDBObserver implements Observer {
    /**
     * 假设的数据保存
     */
    private int[][] db = new int[10][10];

    public void update(Observable observable, Object arg) {
        if (arg instanceof Account) {
            Account obj = (Account) arg;
            int rowNum = obj.getNumOne();
            int colNum = obj.getNumTwo();
            db[rowNum][colNum] = obj.getSum();
            System.out.println("填充[" + rowNum + "][" + colNum + "]=" + obj.getSum());
        }
    }
}
